<?php 

class GetXiaMiMusicNameFromAlbum extends GetXiaMiMusicName{

    //提取专辑在虾米的Id
    public function extractCdNameId() {
        parent::extractCdNameId();

        $urlInfo    = explode('/', $this->_url);
        $this->_cd->setCdNameId(array_pop($urlInfo));
    }

    //提取专辑名字
    public function extractCdName(){
        parent::extractCdName();
        $cdName         = 'NoName';
        $cdNameMode     = '/id="cover_lightbox" title="(.+)" target/i';
        if(preg_match($cdNameMode, $this->_urlHtmlContent, $matchItems)) {
                $cdName = $matchItems[1];
        }

        $this->_cd->setCdName($cdName);
    }

    //提取专辑艺人在虾米的ID
    public function extractCdArtistId() {
        parent::extractCdArtistId();

        $cdArtistIdMode   = '%/(\d+)/%';
        if(preg_match($cdArtistIdMode, $this->_cd->getCdCover(), $matchItems)) {
            $this->_cd->setCdArtistId($matchItems[0]);
        }
    }

    //提取专辑描述信息
    public function extractCdDescription() {
        parent::extractCdDescription();
        $cdDescription  = 'No Description.';
        $cdDescriptionMode  = '/<div\sid="album_intro"(.*)id="show_more">/simx';
        if(preg_match($cdDescriptionMode, $this->_urlHtmlContent, $matchItems)) {
            $cdDescription  = $matchItems[0];
            $cdDescription  = LittleTools::replaceRowTagToN($cdDescription);
            $cdDescription  = LittleTools::filterHtmlTag($cdDescription);
        }
        $this->_cd->setCdDescription($cdDescription);
    }

}

?>
